public class HuffmanNode implements Comparable<HuffmanNode>
{
    String word;
    int weight;
    HuffmanNode left;
    HuffmanNode right;
    String code;


    public HuffmanNode(String word, int weight) {
        this.word = word;
        this.weight = weight;
        this.left = null;
        this.right = null;
        this.code = "";
    }

    public HuffmanNode(int weight, HuffmanNode left, HuffmanNode right) {
        this.word = null;
        this.weight = weight;
        this.left = left;
        this.right = right;
        this.code = "";
    }

    @Override
    public int compareTo(HuffmanNode o) {
        return this.weight - o.weight;
    }

}
